package com.leyou.item.server;

import com.leyou.ExceptionEnum.ExceptionEnum;
import com.leyou.exception.LyException;
import com.leyou.pojo.Item;
import org.springframework.stereotype.Service;

import java.util.Random;
@Service
public class ItemServer {
    public Item saveItem(Item item) {

        if (item.getPrice()==null){
            throw new LyException(ExceptionEnum.PRICE_NOT_FOUND);
        }
        int id = new Random().nextInt(100);
        item.setId(id);
        return item;
    }
}
